/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hotel.test.service.impl;

import com.hotel.test.model.Booking;
import com.hotel.test.service.base.BookingLocalServiceBaseImpl;
import com.hotel.test.service.persistence.BookingUtil;
import com.liferay.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.kernel.exception.SystemException;

/**
 * The implementation of the booking local service.
 *
 * <p>
 * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.hotel.test.service.BookingLocalService} interface.
 *
 * <p>
 * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
 * </p>
 *
 * @author Vien-IT
 * @see com.hotel.test.service.base.BookingLocalServiceBaseImpl
 * @see com.hotel.test.service.BookingLocalServiceUtil
 */
public class BookingLocalServiceImpl extends BookingLocalServiceBaseImpl {

	@Override
	public Booking addBooking(Booking booking) throws SystemException {
		long bookingId = CounterLocalServiceUtil.increment();
		Booking b = BookingUtil.create(bookingId);
		b.setUserId(booking.getUserId());
		b.setUserName(booking.getUserName());
		b.setCreateDate(booking.getCreateDate());
		b.setModifiedDate(booking.getModifiedDate());
		b.setNamePersonBooking(booking.getNamePersonBooking());
		b.setNumberPhone(booking.getNumberPhone());
		b.setEmailBooking(booking.getEmailBooking());
		b.setAddress(booking.getAddress());
		b.setNumberOfGuest(booking.getNumberOfGuest());
		b.setOtherRequest(booking.getOtherRequest());
		b.setDayStart(booking.getDayStart());
		b.setDayFinish(booking.getDayFinish());
		b.setHotelId(booking.getHotelId());
		b.setRomId(booking.getRomId());
		return BookingUtil.update(b, false);
	}
	
}